package com.rongx.transaction.jdbc;


import com.rongx.transaction.Transaction;
import com.rongx.transaction.TransactionFactory;

import javax.sql.DataSource;
import java.sql.Connection;
import java.util.Properties;

/**
 * JDBC事务工厂
 */
public class JdbcTransactionFactory implements TransactionFactory {

    @Override
    public void setProperties(Properties props) {
        // 无属性需要设置
    }

    @Override
    public Transaction newTransaction(Connection conn) {
        return new JdbcTransaction(conn);
    }

    @Override
    public Transaction newTransaction(DataSource dataSource, boolean autoCommit) {
        return new JdbcTransaction(dataSource, autoCommit);
    }
}